/*
 * Filename OrderFeignClient.java 2022年03月03日
 * Copyright © Ehome Co.Ltd. All Rgiths Reserved.
 * @author wuyingchao
 */
package com.ehome.poct.core.api.feign;

import com.ehome.core.page.PageInfo;
import com.ehome.poct.core.api.dto.check.CheckStatusDTO;
import com.ehome.poct.core.api.dto.order.TestOrderDTO;
import com.ehome.poct.core.api.qry.OrderQry;
import com.ehome.poct.core.api.qry.TestOrderQry;
import com.ehome.poct.core.api.vo.order.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *
 *
 * @author wyc
 * @since 2022/03/03 16:21
 **/
@FeignClient(value = "${service.poct-core:}${service.suffix.poct-core:}", path = "/orders", contextId = "order")
public interface OrderClient {
    @PostMapping("/place")
    QrCodeVO saveWithItem(@RequestBody TestOrderDTO order,@RequestParam Boolean isPay);

    @GetMapping("/poll/status/{orderNo}")
    OrderStatusVO pollGetStatus(@PathVariable String orderNo);

    @GetMapping("/manual/status/{orderNo}")
    OrderStatusVO manualGetStatus(@PathVariable String orderNo);

    @GetMapping("/pay/link/{orderNo}")
    QrCodeVO getPayLink(@PathVariable String orderNo);

    @DeleteMapping("/delete/byOrderNo/{orderNo}")
    void delByOrderNo(@PathVariable String orderNo);

    @PostMapping(value = "/union/place/{recordId}")
    QrCodeVO unionPlace(@PathVariable Long recordId, @RequestBody TestOrderDTO order, @RequestParam Integer type);

    @PostMapping(value = "/union/pre/place/{recordId}")
    QrCodeVO prePlace(@PathVariable Long recordId, @RequestBody TestOrderDTO order, @RequestParam Integer type);

    @GetMapping({"/one"})
    TestOrderVO getOne(@SpringQueryMap OrderQry qry);
    @PostMapping("/updateOrderStatus/{orderNo}")
    void updateOrderStatus(@PathVariable String orderNo);

    @GetMapping("/orderitemprice/{orderNo}")
    List<OrderItemPriceVO> orderItemInfo(@PathVariable String orderNo);

    @GetMapping("/page")
    PageInfo<TestOrderVO> pageOrderList(@SpringQueryMap TestOrderQry orderQry);

    @PatchMapping({"/{id}"})
    void update(@PathVariable Long id,@RequestBody TestOrderDTO setStatus);

    @DeleteMapping({"/{id}"})
    void delete(@PathVariable Long id);

    @PostMapping("/updateByOrderNo")
    void updateByOrderNo(@RequestBody CheckStatusDTO checkStatusDTO);
}